7b03c95cfd85cf41cc4a19a116d9b1a94eb588cd,apps/sam/java/src/net/i2p/sam/SAMv1Handler.java,SAMv1Handler,execSessionMessage,#String#StringTokenizer#,160
Before Change
}
props.remove("STYLE");
try {
if (style.equals("RAW")) {
try {
if (dest.equals("TRANSIENT")) {
_log.debug("TRANSIENT destination requested");
ByteArrayOutputStream priv = new ByteArrayOutputStream();
SAMUtils.genRandomKey(priv, null);
dest = Base64.encode(priv.toByteArray());
}
rawSession = new SAMRawSession (dest, props, this);
writeBytes(("SESSION STATUS RESULT=OK DESTINATION=" + dest + "\n").getBytes("ISO-8859-1"));
} catch (DataFormatException e) {
_log.debug("Invalid destination specified");
writeBytes(("SESSION STATUS RESULT=INVALID_KEY DESTINATION=" + dest + "\n").getBytes("ISO-8859-1"));
return true;
} catch (I2PSessionException e) {
_log.debug("I2P error when instantiating RAW session", e);
writeBytes(("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + "\n").getBytes("ISO-8859-1"));
return true;
}
} else {
_log.debug("Unrecognized SESSION STYLE: \"" + style + "\"");
return false;
}
} catch (UnsupportedEncodingException e) {
_log.error("Caught UnsupportedEncodingException ("
+ e.getMessage() + ")");
return false;
} catch (IOException e) {
_log.error("Caught IOException while parsing SESSION message ("
After Change
return writeString("SESSION STATUS RESULT=INVALID_KEY DESTINATION=" + dest + "\n");
} catch (I2PSessionException e) {
_log.debug("I2P error when instantiating session", e);
return writeString("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + "\n");
} catch (SAMException e) {
_log.error("Unexpected SAM error", e);
return writeString("SESSION STATUS RESULT=I2P_ERROR DESTINATION=" + dest + "\n");